<template>
  <div ref="main" />
</template>

<script>
// import * as echarts from 'echarts'
import * as echarts from 'echarts/core'
import { GridComponent } from 'echarts/components'
import { TitleComponent } from 'echarts/components'
import { LineChart } from 'echarts/charts'
import { UniversalTransition } from 'echarts/features'
import { CanvasRenderer } from 'echarts/renderers'
echarts.use([GridComponent, LineChart, CanvasRenderer, UniversalTransition, TitleComponent])

export default {
  data() {
    return {
      option: {
        title: {
          text: '7天房产统计'
        },
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [820, 932, 901, 934, 1290, 1330, 1320],
            type: 'line',
            smooth: true
          }
        ] }
    }
  },
  mounted() {
    const myChart = echarts.init(this.$refs.main) // 得到图表实例
    myChart.setOption(this.option)
  }
}
</script>

<style lang="scss" scoped>
div{
  height: 500px;
}
</style>
